package util;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum BooleanEnum {

    YES(15, "是", "是"),

    //    NOT_INCLUDE_IN_LIST(1, "不是", "!include(seq.set(%s), str(%s))");
    NO(16, "否", "否");

    private final Integer code;
    private final String desc;
    private final String format;

    public static BooleanEnum getConditionOperateType(Integer code) {
        return Arrays.stream(BooleanEnum.values())
                .filter(e -> e.getCode().equals(code))
                .findFirst()
                .orElse(null);
    }

    public static Map<Integer, String> conditionOperateTypeMap = Arrays.stream(BooleanEnum.values())
            .collect(Collectors.toMap(BooleanEnum::getCode, BooleanEnum::getDesc));
}
